import type { ProjectSettings } from '../types'
import configState from '../config/configState'
import componentsConfig from '../config/components'
import menus from '../config/menus'

export default class Config {
  public static projectSettings: ProjectSettings = {
    dbName: 'cms-editor',
    defaultEditorState: {
      debug: false,
      doneGuide: false,
      isNotDefaultView: true,
      header: {
        opened: 'menu'
      },
      scrollbars: {
        component: null,
        componentGroup: null,
        global: null,
        singleGraph: null
      },
      siderPanel: {
        visible: true,
        active: 'component'
        // active: 'global'
      },
      menu: {
        collapsed: false,
        menus,
        openKeys: ['splash', 'video', 'article', 'atlas', 'default'],
        preOpenKeys: ['splash', 'video', 'article', 'atlas', 'default'],
        selectedKeys: ['homeRecommend'],
        selectedKey: 'homeRecommend',
        defaultPages: []
      },
      componentPanel: {
        checked: 'titleBar'
      },
      globalComponents: componentsConfig.globalComponents,
      schemas: {
        global: [],
        component: []
      },
      configState,
      multiGraph: false,
      zoom: 1,
      componentType: undefined
    },
    guide: {
      options: (onNext: () => void) => ({
        animate: true,
        allowClose: false,
        doneBtnText: '我知道了',
        closeBtnText: '关闭',
        nextBtnText: '下一步',
        prevBtnText: '上一步',
        keyboardControl: false,
        className: 'editor-guide',
        stageBackground: 'var(--editor-guide-bg)',
        onNext
        // onDeselected() {
        //   const currentEl = instance.getHighlightedElement()
        //   const steps = instance.getSteps()
        //   if (currentEl?.getNode() === (steps[steps.length - 1] as any).node) {
        //     done()
        //   }
        // }
      }),
      steps: [
        {
          element: '#components-title',
          popover: {
            title: '操作提示',
            description: '组件库的组件仅能设置样式，不能拖动到画布。',
            position: 'right'
          }
        },
        {
          element: '#advs-title',
          popover: {
            title: '操作提示',
            description: '拖动广告库组件到画布，可以添加广告位哦~',
            position: 'right'
          }
        }
      ]
    }
  }
}
